package day15.Task;

import java.util.*;

public class StudentTwo implements Comparable<StudentTwo> {
    private int no;
    private String name;


    public StudentTwo(int no, String name) {
        this.no = no;
        this.name = name;
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        StudentTwo that = (StudentTwo) o;
        return no == that.no;
    }

    @Override
    public int hashCode() {
        return Objects.hash(no);
    }

    @Override
    public String toString() {//“no=XX&name=YY”
        return "\"no=" + no + "&name=" + name;
    }

    @Override
    public int compareTo(StudentTwo o) {
        return this.getName().compareTo(o.getName());
    }
}

class Main2 {
    public static void main(String[] args) {
        StudentTwo[] stu = new StudentTwo[3];
        Scanner sc = new Scanner(System.in);
        StudentTwo studentTwo2 = null;
        String s = sc.nextLine();
        String[] s1 = s.split(" ");
        for (int i = 0; i < 3; i++) {
            stu[i] = new StudentTwo(0, "");
        }
        for (int i = 0,j=0; i < s1.length; i += 2,j++) {
                if (i == 6)
                    studentTwo2 = new StudentTwo(Integer.parseInt(s1[i]), s1[i + 1]);
                else {
                    stu[j].setNo(Integer.parseInt(s1[i]));
                    stu[j].setName((s1[i+1]));
                }
        }
        HashSet<StudentTwo> stuSet = new HashSet<>(Arrays.asList(stu));
        stuSet.add(studentTwo2);
        for (StudentTwo two : stuSet) {
            System.out.println(two);
        }
        Arrays.sort(stu);
        for (StudentTwo two : stu) {
            System.out.println(two);
        }

    }
}